package com.smzd.framework.system.dao;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.smzd.core.dao.AbstractDao;
import com.smzd.core.mappers.IMapper;
import com.smzd.framework.system.domain.UserBind;
import com.smzd.framework.system.mappers.UserBindMapper;

@Component
public class UserBindDao extends AbstractDao<UserBind> {
    @Autowired
    private UserBindMapper mapper;

    @Override
    protected IMapper<UserBind> getMapper() {
        return mapper;
    }

    public UserBind getUserBindByOpenid(String openid) {
        return mapper.getUserBindByOpenid(openid);
    }

    public List<UserBind> getUserBindsByUserId(int userId) {
        return mapper.getUserBindsByUserId(userId);
    }

    public UserBind getUserBindBySocial(int userId, int sid) {
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("userId", userId);
        params.put("sid", sid);
        return mapper.getUserBindBySocial(params);
    }
}